<template>
  <div class="newinfo-container">
    <div class="newshang">
      <h4>{{ newinfo1.title }}</h4>
      <p>
        <span>发表时间:{{newinfo1.add_time | dataFormat}}</span>
        <span>点击次数:{{newinfo1.click}} 次</span>
      </p>
    </div>

    <hr />
    <div class="wenzi" v-html="newinfo1.content"></div>
    <comment :id="this.id"></comment>
  </div>
</template>

<script>
import comment from '../sub-compoents/Comment.vue'
export default {
  data() {
    return {
      newinfo1: []
    };
  },
  props: ["id"],
  created() {
    this.getNewsInfo();
  },
  methods: {
    async getNewsInfo() {
      const { data } = await this.$http.get("/api/getnew/" + this.id);
      //console.log(data);
      if (data.status === 0) return (this.newinfo1 = data.message[0]);
    }
  },
  components:{
      comment
  }
};
</script>

<style lang="scss" scoped>
.newinfo-container {
    padding: 5px;
  .newshang {
    
    h4 {
      font-size: 15px;
      color: red;
      margin: 15px 0;
      text-align: center;
    }
    p{
        color: rgb(55, 133, 153);
        display: flex;
        justify-content: space-between;
    }
  }
  .wenzi{
      img{
          width: 100%;
          height: 100%;
      }
  }
}
</style>